<script src="https://cdn.jsdelivr.net/gh/emn178/js-md5/build/md5.min.js"></script>
<style>
  .warning-box {
    background-color: #ff4d4f;
    color: white;
    border-radius: 10px;
    padding: 20px;
    width: 300px;
    text-align: center;
  }

  .x-icon {
    width: 40px;
    height: 40px;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    font-size: 24px;
    list-style: 1;
  }

  .warning-text {
    margin-bottom: 15px;
  }

  .email {
    font-weight: bold;
  }

  .serial {
    background-color: white;
    color: #ff4d4f;
    padding: 5px;
    margin-top: 15px;
  }

  .stats {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
  }

  .stat {
    text-align: center;
    flex: 1;
  }

  .stat-value {
    font-size: 24px;
    font-weight: bold;
  }
</style>
<div
  style="display: flex;align-items: center;flex-direction: column;gap: 12px;pointer-events: all;">
  <span style="color: #f1c40f; pointer-events: all;"><em><b>QThe original hammer ginseng &amp;
        coffee candy supplier since&nbsp;&nbsp;1999</b></em></span>
  <input type="text" placeholder="Please enter code"
    style="height:48px;background-color: #fff;width: 420px; max-width: 70%; border-radius: 6px; padding: 0 12px;"
    id="h-custom-input1">
  <button id="h-custom-submit"
    style="cursor: pointer;height:48px;line-height: 48px; padding: 0 32px;font-size: 16px; color: #fff;background-color: #f1c40f;border-radius: 30px;">check</button>
</div>
<div>




</div>
<script>
  $(function () {
    let btn = $("#h-custom-submit");
    let input1 = $("#h-custom-input1");
    btn.click(function () {

      let code = input1.val().trim(); // 去除前后空格  
      if (code.length < 10) {
        moi.tooltip({
          placement: "top",
          el: input1,
          timer: 2000,
          space: 0,
          content: "The security code should not be less than 10 digits"
        })
        return;
      }
      getLabelInfo(code);
    });

    /**  
     * 方法作用: 获取码值信息  
     * @param code 码值  
     * @param index index 参数  
     */
    function getLabelInfo(code) {
      let noncestr = randomString(8); // 生成 8 位数的随机字符串  
      let timestamp = new Date().getTime();
      let sign = md5(`data${code}noncestr${noncestr}index2ufqv18784uDnxtimestamp${timestamp}`);
      const load = moi.nodeShowLoading('#h-custom-submit');
      const popupLayer = moi.popup();
      $.ajax({
        url: 'https://m.asy315.vip/query/open',
        type: 'get',
        headers: {
          'Index': "2ufqv18784uDnx", // 假设服务器期望的头部名称是 'Index'  
          'Noncestr': noncestr,
          'Timestamp': timestamp
        },
        data: {
          data: code,
          sign: sign
        },
        dataType: 'json',
        success: function (res) {
          if (res.status === 200) {
            popupLayer.addContent(`  <div class="warning-box" style="background-color: #47B078;">
    <svg t="1729146364004" class="icon" viewBox="0 0 1024 1024" version="1.1"
      xmlns="http://www.w3.org/2000/svg" p-id="2607" width="48" height="48">
      <path fill="#fff"
        d="M512 1024C229.229714 1024 0 794.733714 0 511.963429 0 229.193143 229.229714-0.036571 512-0.036571 794.770286-0.036571 1024 229.193143 1024 511.963429 1024 794.733714 794.770286 1024 512 1024ZM512 73.142857C269.641143 73.142857 73.142857 269.641143 73.142857 512 73.142857 754.358857 269.641143 950.857143 512 950.857143 754.358857 950.857143 950.857143 754.358857 950.857143 512 950.857143 269.641143 754.358857 73.142857 512 73.142857ZM464.676571 684.178286 455.826286 692.992 454.107429 691.273143C449.462857 693.467429 444.342857 694.857143 438.857143 694.857143 431.067429 694.857143 424.228571 691.858286 418.304 687.725714L417.426286 688.566857 413.037714 684.178286C413.001143 684.141714 413.001143 684.141714 412.964571 684.105143L262.253714 533.394286 314.002286 481.682286 438.857143 606.537143 714.422857 330.934857 766.171429 382.683429 464.749714 684.105143C464.713143 684.141714 464.713143 684.141714 464.676571 684.178286Z"
        p-id="2608"></path>
    </svg>
    <div class="warning-text" style="margin-top: 24px;">Successful validation</div>
    <p>companyName:${res.data.companyName}</p>
    <p>productName:${res.data.productName}</p>
    <p>serial:${res.data.serial}</p>
    <p>resellerName:${res.data.resellerName}</p>
    <p>queryTimes:${res.data.queryTimes}</p>
  </div>`);
          } else {
            popupLayer.addContent(`<div class="warning-box">
    <svg t="1729146257339" class="icon" viewBox="0 0 1024 1024" version="1.1"
      xmlns="http://www.w3.org/2000/svg" p-id="1525" width="48" height="48">
      <path
        d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m0-42.666667c212.074667 0 384-171.925333 384-384S724.074667 128 512 128 128 299.925333 128 512s171.925333 384 384 384z m-5.802667-419.968l105.685334-105.706667a21.205333 21.205333 0 0 1 30.08 0.106667 21.269333 21.269333 0 0 1 0.106666 30.08l-105.706666 105.685333 105.706666 105.685334a21.205333 21.205333 0 0 1-0.106666 30.08 21.269333 21.269333 0 0 1-30.08 0.106666l-105.685334-105.706666-105.685333 105.706666a21.205333 21.205333 0 0 1-30.08-0.106666 21.269333 21.269333 0 0 1-0.106667-30.08l105.706667-105.685334-105.706667-105.685333a21.205333 21.205333 0 0 1 0.106667-30.08 21.269333 21.269333 0 0 1 30.08-0.106667l105.685333 105.706667z"
        fill="#fff" p-id="1526"></path>
    </svg>
    <div class="warning-text" style="margin-top: 24px;">
      Warning: This product could be fake or counterfeit because this is not a product of Sino - USA
      Collaboration
    </div>
  </div>`);
          }

        },
        complete: function () {
          load.close();
        },
        error: function (jqXHR, textStatus, errorThrown) {
          popupLayer.addContent(`<div class="warning-box">
    <svg t="1729146257339" class="icon" viewBox="0 0 1024 1024" version="1.1"
      xmlns="http://www.w3.org/2000/svg" p-id="1525" width="48" height="48">
      <path
        d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m0-42.666667c212.074667 0 384-171.925333 384-384S724.074667 128 512 128 128 299.925333 128 512s171.925333 384 384 384z m-5.802667-419.968l105.685334-105.706667a21.205333 21.205333 0 0 1 30.08 0.106667 21.269333 21.269333 0 0 1 0.106666 30.08l-105.706666 105.685333 105.706666 105.685334a21.205333 21.205333 0 0 1-0.106666 30.08 21.269333 21.269333 0 0 1-30.08 0.106666l-105.685334-105.706666-105.685333 105.706666a21.205333 21.205333 0 0 1-30.08-0.106666 21.269333 21.269333 0 0 1-0.106667-30.08l105.706667-105.685334-105.706667-105.685333a21.205333 21.205333 0 0 1 0.106667-30.08 21.269333 21.269333 0 0 1 30.08-0.106667l105.685333 105.706667z"
        fill="#fff" p-id="1526"></path>
    </svg>
    <div class="warning-text" style="margin-top: 24px;">
      Warning: This product could be fake or counterfeit because this is not a product of Sino - USA
      Collaboration
    </div>
  </div>`);
        }
      });
    }

    /**  
     * 方法作用: 生成随机数字+字母的字符串  
     * @param length 要生成的长度 / 几位随机数  
     */
    function randomString(length) {
      const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
      let result = '';
      for (let i = length; i > 0; --i) {
        result += chars[Math.floor(Math.random() * chars.length)];
      }
      return result;
    }
  })

</script>